We need a shorthandle for both read and write.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 20 Jan 2003 20:11:53 +0000 (20:11 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 20 Jan 2003 20:11:53 +0000 (20:11 +0000)
gpsbabel/magproto.c

index c2ca6377f2c2655532630103bfadd4f945356e4e..cf945397a1a9387aa2dfdccdbc1df9c5ee1a9bd9 100644 (file)
@@ -668,6 +668,9 @@ mag_rd_init(const char *portname, const char *args)
        }
 
        terminit(portname);
+       if (!mkshort_handle) {
+               mkshort_handle = mkshort_new_handle();
+       }
 
        if (!noack)
                mag_handon();
@@ -715,8 +718,10 @@ mag_wr_init(const char *portname, const char *args)
        fstat(fileno(magfile_out), &sbuf);
        is_file = S_ISREG(sbuf.st_mode);
 #endif
-       mkshort_handle = mkshort_new_handle();
 
+       if (!mkshort_handle) {
+               mkshort_handle = mkshort_new_handle();
+       }
        if (is_file) {
                magfile_out = fopen(portname, "w+b");
                if (magfile_out == NULL) {